﻿using System;
using UnityEngine;

namespace Core.Base.UI
{
    /// <summary>
    ///  UI属性
    /// </summary>
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
    public sealed class UIAttribute : Attribute
    {
        public UIAttribute(string uiPath, EUIType uIType, bool isCache = false,
            EScreenMatchMode matchMode = EScreenMatchMode.Width)
        {
            UIPath = uiPath;
            UIType = uIType;
            IsCache = isCache;
            MatchMode = matchMode;
        }

        /// <summary>
        /// 预制体所在路径
        /// </summary>
        public string UIPath { get; private set; }

        /// <summary>
        /// Close时是否缓存
        /// </summary>
        public bool IsCache { get; private set; }

        /// <summary>
        /// ui类型.他所在的层级
        /// </summary>
        public EUIType UIType { get; private set; }

        /// <summary>
        /// 屏幕适配模式.宽度或高度适配
        /// </summary>
        public EScreenMatchMode MatchMode { get; private set; }
    }

    public enum EUIType
    {
        /// <summary>
        /// 最底层
        /// </summary>
        BaseCanvas,

        /// <summary>
        /// 中层
        /// </summary>
        MiddleCanvas,

        /// <summary>
        /// 顶层
        /// </summary>
        TopCanvas,

        /// <summary>
        /// 最顶层
        /// </summary>
        TipsCanvas
    }

    public enum EScreenMatchMode
    {
        Width,
        Height
    }
}